package com.ycg.vue.modules.user.mapper;

import com.ycg.vue.Entity.FileEntity;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.Map;

/**
 * @Description
 * @Author jink
 * @Date 2024/2/14 10:33
 */
@Mapper
public interface FileMapper {

    @Insert("INSERT INTO file (id,real_name,size,url,type,upload_time,upload_by) VALUES( #{groupId} , #{name} , #{size} , #{url} , #{type} ,#{uploadTime} ,#{userId} )")
    void insert(@Param("groupId") String groupId, @Param("name") String name, @Param("size") Long size, @Param("url") String url, @Param("type") String type,@Param("uploadTime") Date uploadTime,@Param("userId") String userId);

    @Select("SELECT real_name FROM file WHERE id = #{id}")
    String selectRealNameByGroupId(@Param("id") String id);

    @Select("SELECT * FROM file WHERE id = #{id}")
    FileEntity selectByGroupId(@Param("id") String id);

    @Delete("DELETE FROM file WHERE id = #{id}")
    void deleteFileById(@Param("id") String id);
}
